package com.qinchen.demo.controller;

import com.qinchen.demo.service.IUserService;
import com.qinchen.demo.vo.UserVo;
import com.qinchen.springmvc.annotation.*;

@Controller
public class UserController {

    @Autowired(value = "userService")
    IUserService userService;

    @RequestMapping("/user")
    public String getUser(@RequestParam(value = "id")Long id, @RequestParam(value = "name")String name) {

        System.out.println("接收到参数 id = " + id + ", name = " + name);

        userService.getUserInfo();

        return "/success.jsp";
    }

    @RequestMapping("/toUser")
    public String toUserInfo() {

        String name = userService.getUserInfo();

        return "forward:/success.jsp";
    }

    @RequestMapping("/getUserInfo")
    @ResponseBody
    public UserVo getUserInfo() {

        return new UserVo(1L, "qinchen");
    }

}
